package leetcode.code045;

public class Solution extends Solution045 {

	@Override
	public int jump(int[] nums) {
//		if(nums.length==1)
//			return 0;
		int stepMax = 0;
		int max = 0;
		int times = 0;
		for (int i = 0; i < nums.length; i++) {
			if (i > stepMax) {
				times++;
				stepMax = max;
			}
			int irange = i + nums[i];
			if (irange > max) {
				max = irange;
			}
//			if (max >= nums.length - 1) {
//				return times + 1;
//			}
		}
		return times;
	}

	public static void main(String[] args) {
		Solution so = new Solution();
		so.debug1();
		so.debug2();
		so.debug3();
		so.debug4();

	}

}
